import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { treeData } from '/@/views/demo/tree/data';

export const columns: BasicColumn[] = [
  {
    title: '分类名称',
    dataIndex: 'name',
    align: 'left'
  },
  // {
  //   title: '分类图标',
  //   dataIndex: 'image'
  // },
  {
    title: '层级',
    dataIndex: 'level'
  },
  {
    title: '排序值',
    dataIndex: 'sortOrder'
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '删除标志 true/false 删除/未删除',
    field: 'deleteFlag',
    component: 'Input'
  },
  {
    label: '佣金比例',
    field: 'commissionRate',
    component: 'InputNumber'
  },
];

export const formSchema: FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  { label: '', field: 'id', component: 'Input', show: false },
  { label: '', field: 'parentId', component: 'Input', show: false },
  { label: '', field: 'level', component: 'Input', show: false },
  {
    label: '上级分类',
    field: 'parentTitle',
    component: 'Input',
    dynamicDisabled: true,
    colProps: { span: 21 }
  },
  {
    label: '分类名称',
    field: 'name',
    component: 'Input',
    colProps: { span: 21 }
  },
  {
    label: '排序值',
    field: 'sortOrder',
    component: 'InputNumber',
    colProps: { span: 21 }
  },
  {
    label: '状态',
    field: 'deleteFlag',
    component: 'Switch',
    defaultValue: true,
    componentProps: {
      checkedChildren: '是',
      unCheckedChildren: '否',
    },
    colProps: { span: 21 }
  },
];
